package com.hang.jvm.risc;

public class RISC_V_64_Simulator {

    public void execute(String[] args){
        Memory memory = new Memory(1024*1024);
        RegisterFile registerFile = new RegisterFile();
        InstructionDecoder decoder = new InstructionDecoder(registerFile, memory);
        ControlUnit controlUnit = new ControlUnit(decoder, memory);

        memory.storeWord(0, 0x00200093L); // ADDI x1, x0, 2
        memory.storeWord(4, 0x00308133L); // ADD x2, x1, x1

        // Run the simulator
        for (int i = 0; i < 2; i++) {
            controlUnit.step();
        }

        // Print the result
        System.out.println("x1: " + registerFile.read(1));
        System.out.println("x2: " + registerFile.read(2));

    }

}
